package io.renren.modules.aic.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.aic.entity.AccountingDto;
import io.renren.modules.aic.service.MemberService;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 会员账务
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2018-03-28 12:39:07
 */
@RestController
@RequestMapping("aic/accounting")
public class AccountingController {
	@Autowired
	private MemberService memberService;

	/**
	 * 初始化级别
	 */
	@RequestMapping("/select/{mobile}")
	public R selectByMobile(@PathVariable("mobile") String mobile) {
		AccountingDto accounting = memberService.selectAccountingByMobile(mobile);
		return R.ok().put("accounting", accounting);
	}

	/**
	 * 下级列表
	 */
	@RequestMapping("/subList")
	public R subList(@RequestParam Map<String, Object> params) {
		PageUtils page = memberService.selectAccountingByHigher(params);
		return R.ok().put("page", page);
	}
}
